﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using GrayParrot.Core.Data;
using GrayParrot.Data.EntityFramework;

namespace Test.Dati.Libs
{
    public class CustomerEFFacade : GrayParrot.Data.EntityFramework.FacadeBase<CustomerEFFacade> 
    {
        private Repository<Customer, string> m_repository = null;

        public Repository<Customer, string> Repository
        {
            get { return m_repository; }
        }
        private DbContext<MyDbContext> m_ctx = null;

        public CustomerEFFacade()
        {
        }

        public override void Initialize()
        {
            m_ctx = new DbContext<MyDbContext>();
            m_repository = new Repository<Customer, string>(m_ctx.BuildContext());
        }

        public override void Initialize(System.Data.Entity.DbContext context)
        {
            m_repository = new Repository<Customer, string>(context);
        }

        public override void Dispose()
        {
            
        }
    }
}
